package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.KnowledgeClassifyMapper;
import com.gc.business.domain.KnowledgeClassify;
import com.gc.business.service.IKnowledgeClassifyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 知识库类型 服务层实现
 * 
 * @author liujinteng
 * @date 2020-10-27
 */
@Slf4j
@Service
public class KnowledgeClassifyServiceImpl extends ServiceImpl<KnowledgeClassifyMapper, KnowledgeClassify> implements IKnowledgeClassifyService {

    @Override
    public List<KnowledgeClassify> list(KnowledgeClassify knowledgeClassify){
        LambdaQueryWrapper<KnowledgeClassify> wrapper = new LambdaQueryWrapper<>();
        if(knowledgeClassify != null){
            if(StringUtils.isNotEmpty(knowledgeClassify.getClassifyId())){
                wrapper.eq(KnowledgeClassify::getClassifyId, knowledgeClassify.getClassifyId());
            }
            if(StringUtils.isNotEmpty(knowledgeClassify.getAttrId())){
                wrapper.eq(KnowledgeClassify::getAttrId, knowledgeClassify.getAttrId());
            }
            if(StringUtils.isNotEmpty(knowledgeClassify.getClassifyName())){
                wrapper.like(KnowledgeClassify::getClassifyName, knowledgeClassify.getClassifyName());
            }
            if(StringUtils.isNotEmpty(knowledgeClassify.getCreateBy())){
                wrapper.like(KnowledgeClassify::getCreateBy, knowledgeClassify.getCreateBy());
            }
            if(StringUtils.isNotEmpty(knowledgeClassify.getCreateTime())){
                wrapper.eq(KnowledgeClassify::getCreateTime, knowledgeClassify.getCreateTime());
            }
            if(StringUtils.isNotEmpty(knowledgeClassify.getUpdateBy())){
                wrapper.like(KnowledgeClassify::getUpdateBy, knowledgeClassify.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(knowledgeClassify.getUpdateTime())){
                wrapper.eq(KnowledgeClassify::getUpdateTime, knowledgeClassify.getUpdateTime());
            }
        }
        return baseMapper.selectList(wrapper);
    }
}
